const app = getApp();
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    canIUseGetUserProfile: false,
    canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'), // 如需尝试获取用户信息可改为false
  },

  onLoad() {
    if (app.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
  },


  goto_myinfo: function () {
    wx.navigateTo({
      url: '../myinfo/myinfo',
    })
  },

  goto_suggest: function () {

    wx.navigateTo({
      url: '../suggest/suggest',
    })
    // }
  },

  goto_about: function () {
    wx.navigateTo({
      url: '../about/about',
    })
  },

  go_admin:function(){
    wx.navigateTo({
      url: '../../admin/login/login',
    })
  },

  onTabItemTap(own) {
    if (app.globalData.userInfo.nickName) {
      console.log(app.globalData.userInfo.nickName)
      this.setData({
        userInfo: app.globalData.userInfo
      })
    } else {
      app.getUserProfile()
      console.log(app.globalData.userInfo.nickName)
      this.setData({
        userInfo: app.globalData.userInfo
      })
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }

});